package com.googlecode.dgwt.client.dojox.data;

import java.util.Collection;

import com.googlecode.dgwt.client.dojo.data.model.StoreModel;
import com.googlecode.dgwt.client.dojox.data.base.DataStoreBase;
import com.googlecode.dgwt.client.dojox.data.model.DataModel;
import com.googlecode.dgwt.client.dojox.data.model.base.DataColumnBase;
import com.googlecode.dgwt.client.dojox.data.model.base.DataModelBase;

/**
 * @author wellsantos@wellsantos.com
 * @since 0.01
 */
public class DataStore<Item> extends DataStoreBase<Item,DataModelBase<Item,DataColumnBase<Item, ?>>,DataColumnBase<Item, ?>> {

    public DataStore() {
        this(new DataModel<Item>());
    }

    @SuppressWarnings("unchecked")
    public DataStore(DataModelBase<Item,? extends DataColumnBase<Item, ?>> model) {
        super((DataModelBase)model);
    }

    @SuppressWarnings("unchecked")
    public DataStore(DataModelBase<Item,? extends DataColumnBase<Item, ?>> model, int initialCapacity) {
        super((DataModelBase)model, initialCapacity);
    }

    @SuppressWarnings("unchecked")
    public DataStore(DataModelBase<Item,? extends DataColumnBase<Item, ?>> model, Collection<? extends Item> items) {
        super((DataModelBase)model, items);
    }
    
    protected DataStore(DataStoreBase<Item, DataModelBase<Item, DataColumnBase<Item, ?>>, DataColumnBase<Item, ?>> mirroredStore, DataModelBase<Item, DataColumnBase<Item, ?>> newModel) {
        super(mirroredStore, newModel);
    }

    @Override
    @SuppressWarnings("unchecked")
    public DataStore<Item> createMirror(StoreModel<Item, ?> model) {
        return new DataStore<Item>(this, (DataModelBase) model);
    }

    @Override
    public DataStore<Item> createMirror() {
        return createMirror(getModel());
    }

    @Override
    protected Class<?> getModelBaseClass() {
        return DataModelBase.class;
    }

}
